package ooday04;

import java.util.concurrent.Callable;

public class SecTest {
    public static void main(String[] args) {

        Animal[] animal=new Animal[5];
        animal[0]=new Dog("泡泡",8,"棕");
        animal[1]=new Dog("乌兹",18,"红");
        animal[2]=new Chick("蔡徐坤",2,"黑白相间");
        animal[3]=new Chick("欧耶",4,"白");
        animal[4]=new Fish("小白",1,"白");
        for(int i=0;i<animal.length;i++) {
            System.out.println(animal[i].name);
            animal[i].drink();
            animal[i].eat();

            if (animal[i] instanceof Dog) {
                Dog dog=(Dog)animal[i];
                dog.lookHome();
                dog.swim();
            }
            if(animal[i] instanceof Chick){
                Chick chick=(Chick)animal[i];
                chick.layEggs();
            }
            if(animal[i] instanceof Fish){
                Fish fish=(Fish)animal[i];
                fish.swim();
            }
        }

        Owner owner=new Owner();
        Dog dog=new Dog("小强",2,"黑");
        Chick chick=new Chick("潇洒哥",2,"白色");
        Fish fish=new Fish("小鲤",1,"红");
        owner.feed(dog);
        owner.feed(chick);
        owner.feed(fish);
    }
}
